import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, Validate } from 'class-validator';
import { IsNotExist } from '../../utils/validators/is-not-exists.validator';

export class CreateRoleDto {
	@ApiProperty({
		required: true,
		description: '角色名称',
	})
	@IsNotEmpty()
	@Validate(IsNotExist, ['Role'], {
		message: '该角色已存在',
	})
	name: string;

	@ApiProperty({
		required: false,
		description: '角色说明',
	})
	@IsOptional()
	description: string;
}
